package GUI;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JList;
import java.awt.List;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.ListSelectionModel;
import javax.swing.AbstractListModel;
import javax.swing.JButton;
import javax.swing.ImageIcon;

public class SubscribeCustomer extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {

		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					SubscribeCustomer frame = new SubscribeCustomer();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the Subscribe Customer frame.
	 */
	public SubscribeCustomer() {
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 629, 365);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		
		JLabel lblNewLabel = new JLabel("Subscribe a Customer");
		lblNewLabel.setBounds(176, 11, 279, 32);
		lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18));
		
		JList list = new JList();
		list.setBounds(132, 239, 1, 1);
		
		JList list_2 = new JList();
		list_2.setBounds(34, 148, 92, 116);
		list_2.setModel(new AbstractListModel() {
			String[] values = new String[] {"", "customer 1", "customer 2", "customer 3", "customer 4", "customer 5", "customer 6"};
			public int getSize() {
				return values.length;
			}
			public Object getElementAt(int index) {
				return values[index];
			}
		});
		list_2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		
		JLabel lblSelectACustomer = new JLabel("Select a customer to subscribe :");
		lblSelectACustomer.setFont(new Font("Tahoma", Font.BOLD, 11));
		lblSelectACustomer.setBounds(5, 123, 200, 14);
		
		JList list_1 = new JList();
		list_1.setBounds(432, 148, 166, 73);
		list_1.setModel(new AbstractListModel() {
			String[] values = new String[] {"subscribe type 1", "subscribe type 2", "subscribe type 3"};
			public int getSize() {
				return values.length;
			}
			public Object getElementAt(int index) {
				return values[index];
			}
		});
		list_1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		
		JLabel lblChooseSubsc = new JLabel("Choose a subscription type :");
		lblChooseSubsc.setFont(new Font("Tahoma", Font.BOLD, 11));
		lblChooseSubsc.setBounds(381, 123, 217, 14);
		
		JButton btnSubscripeCustomer = new JButton("Subscripe Customer");
		btnSubscripeCustomer.setBounds(202, 166, 160, 65);
		
		JButton btnBack = new JButton("Back");
		btnBack.setBounds(500, 282, 98, 28);
		btnBack.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				WorkerGUI frame = new WorkerGUI();
				frame.setVisible(true);
				dispose();
			}
		});
		
		JButton btnCancel = new JButton("Cancel");
		btnCancel.setBounds(381, 285, 101, 23);
		btnCancel.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});
		contentPane.setLayout(null);
		contentPane.add(list_2);
		contentPane.add(list);
		contentPane.add(lblNewLabel);
		contentPane.add(btnSubscripeCustomer);
		contentPane.add(list_1);
		contentPane.add(lblSelectACustomer);
		contentPane.add(lblChooseSubsc);
		contentPane.add(btnCancel);
		contentPane.add(btnBack);
		
		JLabel lblNewLabel_1 = new JLabel("");
		lblNewLabel_1.setIcon(new ImageIcon("images//pool.jpg"));
		lblNewLabel_1.setBounds(0, 0, 613, 326);
		contentPane.add(lblNewLabel_1);
		lblNewLabel_1.setLayout(null);
	}
}
